﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ST.WX.MP.Menu.Model
{
	public class WXMenuItem
	{
		/// <summary>
		/// 菜单的响应动作类型
		/// view - 跳转URL
		/// view_limited - 跳转图文消息URL
		/// click - 点击推事件
		/// miniprogram - 小程序
		/// location_select - 弹出地理位置选择器
		/// media_id - 下发消息
		/// pic_photo_or_album - 弹出拍照或者相册发图
		/// pic_sysphoto - 弹出系统拍照发图
		/// pic_weixin - 弹出微信相册发图器
		/// scancode_push - 扫码推事件
		/// scancode_waitmsg - 扫码推事件，且弹出“消息接收中”提示框
		/// </summary>
		public string type { get; set; }

		/// <summary>
		/// 菜单标题，不超过16个字节，子菜单不超过60个字节
		/// </summary>
		public string name { get; set; }

		/// <summary>
		/// 菜单KEY值，用于消息接口推送，不超过128字节
		/// </summary>
		public string key { get; set; }

		/// <summary>
		/// 调用新增永久素材接口返回的合法media_id
		/// </summary>
		public string media_id { get; set; }

		/// <summary>
		/// 网页 链接，用户点击菜单可打开链接，不超过1024字节。 type为miniprogram时，不支持小程序的老版本客户端将打开本url
		/// </summary>
		public string url { get; set; }

		/// <summary>
		/// 小程序的appid（仅认证公众号可配置）
		/// </summary>
		public string appid { get; set; }

		/// <summary>
		/// 小程序的页面路径
		/// </summary>
		public string pagepath { get; set; }

		/// <summary>
		/// 子菜单
		/// </summary>
		public WXMenuItem[] sub_button { get; set; }

		public WXMenuItem()
		{

		}

		public WXMenuItem(string _name, string _key, string _type)
		{
			name = _name;
			key = _key;
			type = _type;
		}

		public WXMenuItem(string _name, string _key, string _url, string _type)
		{
			name = _name;
			url = _url;
			type = _type;
		}

		public WXMenuItem(string _name, string _appid, string _pagepath, string _url, string _key, string _type = "miniprogram")
		{
			name = _name;
			appid = _appid;
			pagepath = _pagepath;
			url = _url;
			key = _key;
			type = _type;
		}
	}
}
